import java.util.Scanner;

public class XiaoLanRun {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int[] days = new int[] {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int year = 2000;
        int mon = 1;
        int day = 1;
        int weekend = 6; // 周六
        int km = 0;
        while (true) {
            // 判断闰平年
            if (isLeapYear(year)) {
                days[2] = 29;
            } else {
                days[2] = 28;
            }
            // 遍历每一天
            if (day == 1 || weekend == 1) {
                km += 2;
            } else {
                km ++;
            }
            day ++;
            weekend = (weekend + 1) % 7;
            if (day > days[mon]) {
                day = 1;
                mon ++;
                if (mon > 12) {
                    mon = 1;
                    year ++;
                }
            }
            if (year == 2020 && mon == 10 && day == 1) {
                km += 2;
                break;
            }
        }
        System.out.println(km);
        scan.close();
    }


    public static boolean isLeapYear(int year) {
        if (year % 4 == 0) {
            if (year % 100 != 0 || year % 400 == 0) {
                return true;
            }
        }
        return false;
    }
}
